package com.example.shop_2304.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Child
import com.example.shop_2304.R
import com.example.shop_2304.utils.GlideUtils

class TwoAdapter:BaseQuickAdapter<Child,BaseViewHolder>(R.layout.item_two) {
    var selectedType = 534
    override fun convert(holder: BaseViewHolder, item: Child) {
        holder.setText(R.id.two_tv,item.name)
        GlideUtils.loadImage(context,item.extra,holder.getView(R.id.two_iv))
        if(item.id==selectedType){
            holder.setTextColor(R.id.two_tv, Color.RED)
        }else{
            holder.setTextColor(R.id.two_tv, Color.BLACK)
        }
    }

    fun setType(type:Int){
        selectedType = type
        notifyDataSetChanged()
    }
}